import { ajax } from '@/utils'

const baseUrl = '/system/menu'

export default {
  getMenuList(...args: IGetMenuListReq): Promise<IGetMenuListRes> {
    return ajax.post(`${baseUrl}/list`, args[0])
  },
  getMenuTree(): Promise<IGetMenuTreeRes> {
    return ajax.get(`${baseUrl}/tree`)
  },
  createMenu(...args: ICreateMenuReq): IVoidRes {
    return ajax.post(`${baseUrl}/create`, args[0])
  },
  updateMenu(...args: IUpdateMenuReq): IVoidRes {
    return ajax.put(`${baseUrl}/update/${args[0]}`, args[1])
  },
  deleteMenu(...args: IDeleteReq): IVoidRes {
    return ajax.delete(`${baseUrl}/delete`, { data: args[0] })
  }
}
